<%@page import="com.gqs.bookstore.dao.CatalogDao"%>
<%@page import="com.gqs.bookstore.dao.impl.CatalogDaoImpl"%>
<%@page import="com.gqs.bookstore.vo.Catalog"%>
<%@page import="java.util.Date"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	<%
		request.setCharacterEncoding("UTF-8");//只针对post表单提交有效
		String name = request.getParameter("name");
		String status = request.getParameter("status");
		Date updateAt = new Date();//这里默认给出当前时间，后期根据需要在前台输入时间
		Date createAt = new Date();
		
		Catalog catalog = new Catalog(name,updateAt,createAt);
		if("禁用".equals(status)){
			catalog.setStatus((Integer)0);
		}
		if("启用".equals(status)){
			catalog.setStatus((Integer)1);
		}
		CatalogDao catalogDao = new CatalogDaoImpl();
		catalogDao.save_only(catalog);
		response.sendRedirect("index.jsp");
	%>

</body>
</html>